package com.sdweizan.sdk.bytedance.bean.notify;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;

import com.sdweizan.sdk.bytedance.bean.refund.general.BdRefundItemOrderDetail;
import lombok.Data;
import lombok.EqualsAndHashCode;

/** 通用交易-退款申请回调** */
@EqualsAndHashCode(callSuper = true)
@Data
public class BdOrderRefundApplyNotifyRequest extends BdBaseNotify {
  public Msg getMessage() {
    return JSON.parseObject(super.getMsg(), Msg.class);
  }

  @Data
  public static class Msg {
    @JSONField(name = "app_id")
    private String appId;

    @JSONField(name = "open_id")
    private String openId;

    /** 抖音开平侧退款单号 * */
    @JSONField(name = "refund_id")
    private String refundId;

    /** 抖音开平侧订单号 * */
    @JSONField(name = "order_id")
    private String orderId;

    /** 开发者侧订单号 * */
    @JSONField(name = "out_order_no")
    private String outOrderNo;

    @JSONField(name = "refund_total_amount")
    private Long refundTotalAmount;

    /** 是否需要退款审核： 1：需要退款审核 2：不需要退款审核 不需要退款审核，则无需再调用退款审核结果同步接口* */
    @JSONField(name = "need_refund_audit")
    private Integer needRefundAudit;

    /** 退款审核的最后期限，超过该期限无需商家审核，自动退款，13 位时间戳，单位毫秒 通常是3天(从退款发起时间开始算) * */
    @JSONField(name = "refund_audit_deadline")
    private Long refundAuditDeadline;

    /** 退款创建时间，13 位时间戳，单位毫秒* */
    @JSONField(name = "create_refund_time")
    private Long createRefundTime;

    /** 退款补充说明 * */
    @JSONField(name = "refundDescription")
    private String refundDescription;

    /** 退款来源： 1：用户发起退款 4：抖音客服退款 * */
    @JSONField(name = "refund_source")
    private Integer refundSource;

    /** cp 自定义字段* */
    @JSONField(name = "cp_extra")
    private String cpExtra;

    /** 退款原因，退款原因有多个 * */
    @JSONField(name = "refund_reason")
    private List<String> refundReason;

    @JSONField(name = "refund_item_detail")
    private List<RefundItemDetail> refundItemDetail;

    @Data
    static class RefundItemDetail {

      /***用户需要退款多少个商品单 ***/
      @JSONField(name = "item_order_quantity")
      private Integer item_order_quantity;

      /***本次退款的商品单列表 ***/
      @JSONField(name = "item_order_detail")
      private List<BdRefundItemOrderDetail> itemOrderDetail;

    }
  }
}
